<?php 
namespace app\common\model;
use think\Model;
use think\Db;
use think\Request;

class SystemModel extends Model{

	 /**
     * 充值区间 接口
     * @return
     */
    public function recharge($min,$max){
        $data = [];
    	$result = Db::name('order')
        // ->fetchSql(true)
    	->field("player_id")
    	->distinct(true)
        ->where('fee',['EGT',$min],['ELT',$max],'and')
    	->select();
        foreach ($result as $key => $value) {
            $data[] = $value['player_id'];
        }
        return $data;
    }

    /**
     * 亲友圈玩家 接口
     * @return
     */
    public function club_user($club_id){
        $data = [];
    	$result = Db::name('user_club')
    	->field("player_id")
    	->distinct(true)
    	->where('club_id','IN',$club_id)
    	->select();
        foreach ($result as $key => $value) {
            $data[] = $value['player_id'];
        }
        return $data;
    }
     /**
     * 附件转格式 接口
     * @return
     */
    public function format($goods){
        $arr =[];
        $array =[];
        $break_up =explode(';',$goods);
        foreach ($break_up as $key => $value) {
           $arr= explode(',',$value);
//           print_r($arr);
           $array[$arr['0']] = $arr['1'];
        }
         return $array;
        
    }
    /**
     * 删除所有空格
     * @return
     */
    function trimall($str){ //删除空格
        $oldchar=array(" ","　","\t","\n","\r");
        $newchar=array("","","","","");
        return str_replace($oldchar,$newchar,$str);
    }
}
?>